![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
symbol-table
Advanced tools
A data structure for tracking symbols in a compiler or interpreter.
var SymbolTable = require("symbol-table");
//create the root scope
var s0 = SymbolTable();
//define some symbols
s0.set("a", 1);
s0.set("b", 2);
//now enter a sub-scope that inherits s0
var s1 = s0.push();
//define/override symbols in the new scope
s1.set("b", 200);
s1.set("c", 300);
//s1 inherited "a"
s1.get("a");
//-> 1
//s1 changed "b"
s1.get("b");
//-> 200
//but s0 "b" was not touched
s0.get("b");
//-> 2
//s1 has "c", but s0 does not
s1.has("c");
//-> true
s0.has("c");
//-> false
Creates a new symbol table.
Returns true if the symbol is in scope.
Returns the value associated with that symbol in scope. Returns undefined if not found.
Set the value associated with symbol. This can be anything you want. It can be another data structure if you need to store symbol values and type information for example.
Remove a symbol from a scope
Return a new scope that inherits the current scope.
Create a stack of symbol tables/scopes where you always work with the current scope at the top of the stack. It has the same API as the symbol table except you push/pop the scope.
var SymbolTableStack = require("symbol-table/stack");
var s = SymbolTableStack();
s.set("a", 1);
s.push();
s.set("a", 2);
s.get("a");
//-> 2
s.pop();
s.get("a");
//-> 1
These all work the same as the symbol table. However, it will always be the scope at the top of the stack.
Creates a new table/scope and pushes it on top of the stack. It also returns the new table.
Pops the current table/scope off the stack.
Get the stack height (initially it's 1)
What was the stack height when this symbol was set/defined? Returns undefined if the symbol is not found.
MIT
FAQs
A data structure for tracking symbols in a compiler or interpreter.
We found that symbol-table demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.